audio_form object
This method allows you to specify an existing tts_voice object to be used for any Sapi 5 spoken output in the form.
bool set_tts_object(tts_voice@ handle)
Parameters:
handle
A handle to an existing tts_voice object that is to be used for all subsequent Sapi 5 output.
Return value:
true on success, false on failure.
Remarks:
This method is useful if you wish to preserve any settings such as rate, volume etc of an existing tts_voice object. The object that you specify in this function will be used for all subsequent text strings spoken by Sapi 5. If you do not call this method and still use Sapi output, an internal tts_voice object with default settings will be used instead.
Example:
// Make a simple form with redirected Sapi.
#include "form.bgt"
audio_form form;
tts_voice my_voice;
void main()
{
my_voice.rate=120;
form.set_tts_object(my_voice);
form.create_window("Test", true);
while(true)
{
form.monitor();
wait(5);
if((key_down(KEY_LMENU))&&(key_pressed(KEY_F4)))
{
my_voice.speak_interrupt_wait("Exiting.");
exit();
}
}
}